package com.project.common.exception;


import com.project.common.constant.ResultCode;

public class ApiException extends RuntimeException {

    /**
     * 异常code
     */
    private final int code;

    /**
     * 异常提示
     */
    private final String msg;

    public ApiException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public ApiException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
